package com.situ.mall.service.impl;

import com.situ.mall.mapper.OrderItemMapper;
import com.situ.mall.mapper.OrderMapper;
import com.situ.mall.pojo.entity.Order;
import com.situ.mall.pojo.entity.OrderItem;
import com.sun.org.apache.xpath.internal.operations.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.situ.mall.mapper.UserMapper;
import com.situ.mall.pojo.entity.User;
import com.situ.mall.service.IUserService;

import java.util.List;

@Service
public class UserServiceImpl implements IUserService{
	@Autowired
	private UserMapper userMapper;
	@Autowired
	private OrderMapper orderMapper;
	@Autowired
	private OrderItemMapper orderItemMapper;
	
	
	@Override
	public User selectUserLogin(String username, String password) {
		System.out.println(password);
		User user = userMapper.selectByLogin(username, password);
		return user; 
	}

	@Override
	public List<Order> selectUserOrder(Integer id) {
		List<Order> list = orderMapper.selectByUserId(id);
		return list;
	}

	@Override
	public List<OrderItem> selectUserOrderItem(Integer id) {
		List<OrderItem> list = orderItemMapper.selectByUserId(id);
		return list;
	}

}
